import Vue from 'vue'
import VueRouter from 'vue-router'
import MSitePage from '../views/Msite.vue'
import SearchPage from '../views/Search.vue'
import OrderPage from '../views/Order.vue'
import ProfilePage from '../views/Profile.vue'
import Login from '../views/Login'
import UserInfo from '../views/userInfo'
import ShopList from '../views/shop'
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/msite',
    component: MSitePage,
    meta: {
      showFooter: true
    }
  },
  {
    path: '/search',
    component: SearchPage,
    meta: {
      showFooter: true
    }
  },
  {
    path: '/order',
    component: OrderPage,
    meta: {
      showFooter: true
    }
  },
  {
    path: '/profile',
    component: ProfilePage,
    meta: {
      showFooter: true
    }
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/userinfo',
    component: UserInfo
  },
  {
    path: '/shop',
    component: ShopList
  }
]
const router = new VueRouter({
  routes
})

export default router
